7  3D model with annotations

7.1 3D model with annotations - https://wikibase.wbworkshop.tibwiki.io/wiki/Item:Q469

This page shows a 3D model .obj file using the obj2html Python library found at https://z-uo.medium.com/visualize-3d-model-in-jupyter-notebook-e5a9deca20c6. This converts a .obj file to HTML and then displays the HTML.

This is currently using a 9.9 MB test model object because the dining room 3D model is 148.6 MB and is currently not working with this script.

<<<<<<< HEAD
Code =======
>>>>>>> 27efcc21395a8eb5c12800ef9c29ffb886a3da25
from obj2html import obj2html
from IPython.display import display, HTML

obj2html('model.obj', 'model.html')
<<<<<<< HEAD
#obj2html('Tafelstube_Final_4_JL_US.obj', 'model.html')

display(HTML('model.html'))
======= #obj2html('Tafelstube_Final_4_JL_US.obj', 'model.html') display(HTML('model.html'))
>>>>>>> 27efcc21395a8eb5c12800ef9c29ffb886a3da25

The below code performs a SPARQL query to get the annotations for a specific target entity, in this case Q446 ‘Weikersheim, Dining room CAD model’ (https://wikibase.wbworkshop.tibwiki.io/wiki/Item:Q446).

<<<<<<< HEAD

The below code produces a QR code for this page.

Code
from PIL import Image
import qrcode

# Link for website
input_data = "https://nfdi4culture.github.io/cp4c/model_with_annotations.html"

#Creating an instance of qrcode
qr = qrcode.QRCode(
        version=1,
        box_size=10,
        border=5)
qr.add_data(input_data)
qr.make(fit=True)
img = qr.make_image(fill='black', back_color='white')

display(img)

=======
import sparql_dataframe

# Specify the NFDI4Culture Wikibase SPARQL endpoint
endpoint_url = 'https://query.wbworkshop.tibwiki.io/proxy/wdqs/bigdata/namespace/wdq/sparql'

# Query
query = """
SELECT ?annotation ?annotationLabel ?description ?title
WHERE { 
    ?annotation tibt:P50 tib:Q446.
    ?annotation schema:description ?description.
    ?annotation tibt:P30 ?title
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
#All annotations for a specific target entity"
"""

dataframe = sparql_dataframe.get(endpoint_url, query, post=True)

dataframe
annotation annotationLabel description title
0 https://wikibase.wbworkshop.tibwiki.io/entity/... The dining room annotation for: Weikersheim, Tafelstube CAD Mo... Die Tafelstube
>>>>>>> 27efcc21395a8eb5c12800ef9c29ffb886a3da25